1. Field of the Invention
The present invention relates generally to systems, methods, and computer-usable medium for defragmenting a Windows NT file system volume. In particular, the present invention is directed towards systems, methods, and computer-usable medium for defragmenting a Windows NT file system volume, in which data associated with a non-resident attribute is stored in data extents, the data extents are queried without opening the non-resident attribute, e.g., by using a FSCTL_GET_NTFS_FILE_RECORD command, and various non-resident attributes are selectively defragmented based on information obtained from querying the data extents, e.g., based on a location of each non-resident attribute.
2. Background of the Invention
The structure of a Windows NT file system begins with a volume which corresponds to a logical partition on a disk. A disk may comprise one or more volumes, and each volume may comprise a series of files which are stored as a collection of attributes. Each file attribute may be stored as a separate stream of bytes within a file. A Windows NT file systems keeps track of the files of a volume in a relational database called a master file table, which acts as a table of contents for the volume by storing a file record for each file on the volume. If a particular file is too large for all of the attributes of the file to be stored in the file record, which generally is the case, the Windows NT file system begins a series of expansions to move the attributes of the particular file out of the file record and to store the attributes as non-resident blocks of data called data extents, and the data extents store data associated with the non-resident attributes.
In the normal course of computing on an operating system, files are created, extended, truncated, and deleted. This process leads to the creation of gaps in the Windows NT file system volume. Consequently, large areas of free space that are present early in the Windows NT file system volume's life will break down into smaller free areas throughout the Windows NT file system volume, and it may become necessary to fragment new files in order to store the new files in the Windows NT file system volume, which impedes performance. In order to improve system performance, it is desirable to regularly defragment the Windows NT file system volume.
Systems and methods for defragmenting a Windows NT file system volume are known in the art. In one known method for defragmenting a Windows NT file system volume, a file record which is stored in a master file table is selected, and a non-resident attribute associated with the file record is opened and its extents queried using a FSCTL_GET_RETRIEVAL_POINTERS command. Based on information which is obtained from opening the non-resident attribute and using the FSCTL_GET_RETRIEVAL_POINTERS command, e.g., the location of the non-resident attribute, it then is determined whether to defragment the non-resident attribute.
Nevertheless, in such known methods for defragmenting a Windows NT file system volume, in order to determine whether to defragment each non-resident attribute, it is necessary to open each non-resident attribute. Each time that a non-resident attribute is opened, the operating system consumes memory. Thus, in the known method for defragmenting a Windows NT file system volume, it is necessary to open each non-resident attribute prior to determining whether to defragment the non-resident attribute, such that each non-resident attribute is opened regardless of whether or not the non-resident attribute ultimately is subjected to defragmentation. Moreover, disk capacities are growing at a faster rate than memory capacities, especially with respect to large servers. Therefore, the problems associated with memory usage from opening non-resident attributes using the known method for defragmenting a Windows NT file system volume will increase in the future.